package com.jike.shop.cloud.controller;


import com.jike.shop.cloud.service.OrderInfoService;
import com.jike.shop.common.enums.ResultCodeEnum;
import com.jike.shop.common.message.Replys;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 父订单主表 前端控制器
 * </p>
 *
 * @author liconglong
 * @since 2022-07-09
 */
@RestController
@RequestMapping("/order-info")
@Slf4j
public class OrderInfoController {

    @Autowired
    private OrderInfoService orderInfoService;

    @PostMapping("/pay")
    public ResponseEntity<Replys<Boolean>> payOrder(Long orderId){
        try {
            orderInfoService.payOrder(orderId);
            return Replys.ok(true);
        }catch (Exception e){
            log.error("支付异常：{}", e.getMessage());
            return Replys.fail(ResultCodeEnum.ERROR.getCode(), e.getMessage());
        }

    }

}

